package com.adcc.pushXml.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author LHB
 * @date 2019/11/25 11:16
 */
@Component
public class Utils  implements  InitializingBean{

    /**
     * 计算航向角
     * @param lat_a
     * @param lng_a
     * @param lat_b
     * @param lng_b
     * @return
     */
    public static double getAngle1(double lat_a, double lng_a, double lat_b, double lng_b) {
        double y = Math.sin(lng_b - lng_a) * Math.cos(lat_b);
        double x = Math.cos(lat_a) * Math.sin(lat_b) - Math.sin(lat_a) * Math.cos(lat_b) * Math.cos(lng_b - lng_a);
        double bearing = Math.atan2(y, x);

        bearing = Math.toDegrees(bearing);
        if (bearing < 0) {
            bearing = bearing + 360;
        }
        return bearing;

    }




    @Autowired
    private RedisTemplate redisTemplate;
    public void Test(){

        System.out.println( redisTemplate.opsForValue().get("CCA4379"));
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        Test();
    }
}
